package com.meixiang.shardApi;

import android.util.Log;

import com.meixiang.R;

import cn.sharesdk.framework.Platform;
import cn.sharesdk.onekeyshare.ShareContentCustomizeCallback;
import cn.sharesdk.framework.Platform.ShareParams;
/**
 * 作者：黑哥 on 2016/8/3 15:41
 */



public class ShareContentCustomize implements ShareContentCustomizeCallback {
    private String content,TitleUrl,ImageUrl;
    public ShareContentCustomize(String content,String ImageUrl,String TitleUrl) {
        this.content=content;
        this.ImageUrl=ImageUrl;
        this.TitleUrl=TitleUrl;

        Log.e("TAG","输出当前数据=="+"--ImageUrl="+ImageUrl+"--TitleUrl="+TitleUrl);
    }

    public void onShare(Platform platform, ShareParams paramsToShare) {
        String text = platform.getContext().getString(R.string.share_title);
        if ("WechatMoments".equals(platform.getName())) {
            // 改写twitter分享内容中的text字段，否则会超长，
            // 因为twitter会将图片地址当作文本的一部分去计算长度
//            text += platform.getContext().getString(R.string.share_to_wechatmoment);
            paramsToShare.setTitle(text);
            paramsToShare.setText(content);
            paramsToShare.setTitleUrl(TitleUrl);
            paramsToShare.setImageUrl(ImageUrl);


        }else if("SinaWeibo".equals(platform.getName())){
            paramsToShare.setTitle(text);
            paramsToShare.setText(content);
            paramsToShare.setTitleUrl(TitleUrl);
            paramsToShare.setImageUrl(ImageUrl);
        }else if("TencentWeibo".equals(platform.getName())){
            paramsToShare.setTitle(text);
            paramsToShare.setText(content);
            paramsToShare.setTitleUrl(TitleUrl);
            paramsToShare.setImageUrl(ImageUrl);
        }else if("ShortMessage".equals(platform.getName())){
            paramsToShare.setTitle(text);
            paramsToShare.setText(content);
            paramsToShare.setTitleUrl(TitleUrl);
            paramsToShare.setImageUrl(ImageUrl);
        } else if("QQ".equals(platform.getName())){
            paramsToShare.setTitle(text);
            paramsToShare.setText(content);
            paramsToShare.setTitleUrl(TitleUrl);
            paramsToShare.setImageUrl(ImageUrl);

        }else if("ShortMessage".equals(platform.getName())){
            paramsToShare.setTitle(text);
            paramsToShare.setText(content);
            paramsToShare.setTitleUrl(TitleUrl);
            paramsToShare.setImageUrl(ImageUrl);

        }
    }


}
